% SPDX-License-Identifier: GPL-3.0-or-later OR CC-BY-SA-4.0
\section{Main Page}\label{sec:main-page} %%##$section-title>>
%%!!intro<<
Main page lists all the installed, uninstalled and backed up applications. A single click on any
installed application item opens the respective \hyperref[sec:app-details-page]{App Details page}.
For the uninstalled system applications, a dialog prompt is displayed with an option reinstall them.
The applications uninstalled without removing their data and signatures are also displayed in this
page with an option to perform a full uninstallation. For the uninstalled applications having one or
more backups, the restore dialog is displayed. Using the \hyperlink{par:main-page-sort}{sort} option
from the list options, the items can be sorted in various ways. It is also possible to filter items
using the \hyperlink{par:main-page-filter}{filter} option in the list options. Filtering is also
possible from the search bar with additional support for the regular expressions.
%%!!>>

\begin{figure}[ht]
    \centering
    \includesvg[inkscapelatex=false, scale=0.6, keepaspectratio]{../images/main_page_entry_info_labeled.svg}
    \caption{An application list item in the main page} %%##$how-app-ops-work-title>>
    \label{fig:main_page_entry_info_labeled}
\end{figure}

\subsection{Batch Operations}\label{subsec:batch-operations} %%##$batch-operations-title>>
%%!!batch-operations<<
Batch operations or operations on multiple applications are also available within this page.
Multiple selection mode can be activated by clicking on the app icon of an item or by long-clicking
on any items in the list. Once activated, a click on an item selects it instead of opening the App
Details page. In this mode, the batch operations are located in the multiple selection menu at the
bottom of the page. The operations include:
\begin{itemize}
    \item Adding the selected applications to a \hyperref[sec:profiles-page]{profile}
    \item \hyperref[sec:backup-restore]{Backing up applications}, or restoring and deleting the
    existing backups
    \item Blocking the trackers from the applications
    \item Clearing data or cache from the applications
    \item Exporting the blocking rules configured inside App Manager
    \item Exporting the list of applications in Markdown, CSV, JSON or XML format
    \item Freezing/unfreezing/force-stopping/uninstalling the applications
    \item Performing run-time optimization of the applications (Android 7 onwards)
    \item Preventing the background operations of the applications (Android 7 onwards)
    \item Saving the APK files to \texttt{AppManager/apks}
    \item Setting \hyperref[sec:net-policy]{net policies}
\end{itemize}

\begin{tip}{Accessibility}
    After the multiple selection mode has been activated, it is possible to navigate in or out of
    the multiple selection menu using the right or left keys of the keyboard or remote.
\end{tip}
%%!!>>

\subsection{Colour Codes}\label{subsec:main-colour-codes} %%##$colour-codes-title>>
%%!!colour-codes<<
\begin{itemize}
    \item \colorbox{uninstalled-day}{\textcolor{black}{Red (day)}} / \colorbox{uninstalled-night}{\textcolor{white}
    {dark red (night)}} -- Uninstalled application
    \item \colorbox{disabled-day}{\textcolor{black}{Light red (day)}} / \colorbox{disabled-night}{\textcolor{white}
    {very dark red (night)}} -- Frozen application
    \item \colorbox{force-stopped}{\textcolor{white}{Dark cyan}} -- Force-stopped application
    \item \colorbox{AMYellow}{\textcolor{black}{Yellow Star}} -- Debuggable application

    \item \textcolor{AMOrange}{Orange \textit{Date}} -- The application can read system logs
    \item \textcolor{AMOrange}{Orange \textit{UID}} -- The user ID is being shared among multiple applications
    \item \textcolor{AMOrange}{Orange \textit{SDK}} -- The application possibly uses cleartext (i.e.\ HTTP) traffic
    \item \textcolor{tracker-day}{Light orange \textit{package name}} -- The application has one or more trackers
    \item \textcolor{red}{Red \textit{app label}} -- The application does not allow clearing its data
    \item \textcolor{AMDarkCyan}{Dark cyan \textit{version}} -- Inactive application
    \item \textcolor{magenta}{Magenta type} -- Persistent application i.e.\ it remains running all the time

    \item \textcolor{red}{Red \textit{backup}} -- The uninstalled application with one or more
    backups present in App Manager
    \item \textcolor{AMOrange}{Orange \textit{backup}} -- Outdated backup, i.e.\ the base backup
    contains an older version of the installed application
    \item \textcolor{AMDarkCyan}{Dark cyan \textit{backup}} -- Up to date backup, i.e.\ the base
    backup contains the same or higher version of the installed application.
\end{itemize}
%%!!>>

\subsection{Application Types}\label{subsec:main-page-application-types} %%##$application-types-title>>
%%!!application-types<<
An application can be either a \textbf{User} or a \textbf{System} application along with the following suffixes:
\begin{itemize}
    \item \texttt{X} -- Supports multiple architectures
    \item \texttt{0} -- No dex files present in the application
    \item \texttt{°} -- Suspended application
    \item \texttt{\#} -- The application requested the system to allocate a large heap i.e.\ large runtime memory
    \item \texttt{?} -- The application requested the virtual machine to be in the safe mode.
\end{itemize}
%%!!>>

\subsection{Version Info}\label{subsec:main-page-version-info} %%##$version-info-title>>
%%!!version-info<<
Version name is followed by the prefixes below:
\begin{itemize}
    \item \texttt{\_} -- No hardware acceleration (breaking the in-app animations or transparencies)
    \item \texttt{\textasciitilde} -- Test-only application
    \item \texttt{debug} -- Debuggable application
\end{itemize}
%%!!>>

\subsection{Options Menu}\label{subsec:main-page-options-menu} %%##$options-menu-title>>
%%!!options-menu<<
Options menu offers several options that can be used to sort and filter the listed applications as well as to navigate
to different pages within or outside App Manager.
%%!!>>

\subsubsection{List Options}\label{subsubsec:main-list-options} %%##$list-options-title>>
%%!!list-options<<
\textbf{List options} contain the options to sort and filter the list in the main page.
%%!!>>

\paragraph{Sort}\hypertarget{par:main-page-sort}{} %%##$sort-title>>
%%!!sort<<
The applications listed in the main page can be sorted in the following ways:
\begin{itemize}
    \item \textbf{User apps first.} The user applications are listed on top
    \item \textbf{App label.} Sort the list in ascending order based on their application labels (also known as
    \textit{application names}). This is the default sorting preference
    \item \textbf{Package name.} Sort the list in ascending order based on their package names
    \item \textbf{Last update.} Sort the list in descending order based on the date they were last updated
    \item \textbf{Shared user ID.} Sort the list in descending order based on their kernel user ID
    \item \textbf{Target SDK.} Sort the list in ascending order based on their target SDK
    \item \textbf{Signature.} Sort the list in ascending order based on their signing information
    \item \textbf{Frozen first.} The frozen applications are listed on the top
    \item \textbf{Blocked first.} Sort the list in descending order based on the number of blocked components each
    application has
    \item \textbf{Backed up first.} Display the applications with backups on the top
    \item \textbf{Trackers.} Sort the list in descending order based on the number of tracker components each
    application has
    \item \textbf{Last actions.} Sort the list in descending order based on the latest time and date of any actions made
    to the applications within App Manager.
    \item \textbf{Installation date.} Sort the list by the date of installation in descending order.
    \item \textbf{Total size.} Sort the list by the total size of the applications and their data in descending order. Requires \texttt{Usage Access} permission.
    \item \textbf{Data usage.} Sort the list by the total data usage in descending order. Requires \texttt{Usage Access} permission.
    \item \textbf{Times opened.} List frequently used applications on top. Requires \texttt{Usage Access} permission.
    \item \textbf{Screen time.} List the applications with the highest engagements on top. Requires \texttt{Usage Access} permission.
    \item \textbf{Last used.} List last used apps on top. Requires \texttt{Usage Access} permission.
\end{itemize}

In addition, there is the \textit{reverse} option that can be used to sort the list in the reverse order. Regardless of
the sorting preferences, the applications are sorted alphabetically at first in order to prevent producing any random
sorting results.
%%!!>>

\paragraph{Filter}\hypertarget{par:main-page-filter}{} %%##$filter-title>>
%%!!filter<<
The applications listed in the main page can be filtered in the following ways:
\begin{itemize}
    \item \textbf{User apps.} List only the user applications
    \item \textbf{System apps.} List only the system applications
    \item \textbf{Frozen apps.} List only the frozen applications
    \item \textbf{Stopped apps.} List only the applications that were forced-stopped
    \item \textbf{Installed apps.} List only the installed applications
    \item \textbf{Uninstalled apps.} List only the uninstalled applications
    \item \textbf{With rules.} List the applications with one or more blocking rules
    \item \textbf{With activities.} List the applications with one or more activities
    \item \textbf{With backups.} List the applications with one or more backups
    \item \textbf{Without backups.} List the applications with no backups present.
    \item \textbf{Running apps.} List the applications that are currently running
    \item \textbf{With splits.} List the applications with one or more split APK files
    \item \textbf{With KeyStore.} List only the applications with Android KeyStore.
    \item \textbf{With SAF.} List only the applications with SAF access.
    \item \textbf{With SSAID.} List only the applications with a valid SSAID\@.
\end{itemize}

Unlike sorting, it is possible to apply more than one filtering options at the same time. For example, the frozen user
applications can be listed by selecting both \textit{User apps} and \textit{Frozen apps}. This can be particularly
useful for \hyperref[subsec:batch-operations]{batch operations} where filtering the user applications may be necessary
to carry out certain operations safely.

\begin{warning}{Inconsistencies}
    App Manager extensively caches everything in this page. Therefore, certain states (e.g., freeze
    and stopped states) may not always be up-to-date.
\end{warning}
%%!!>>

\paragraph{Profile Name}%%##$profile_name-title>>
%%!!profile_name<<
It is also possible to list the applications that are only present in a \hyperref[sec:profiles-page]{profile}. This can
be useful for carrying out certain operations on a profile (e.g., uninstalling all the applications in a profile) that
cannot be done via the \hyperref[sec:profiles-page]{Profiles page}.
%%!!>>

\subsubsection{User Manual} %%##$instructions-title>>
%%!!instructions<<
Clicking on the \textbf{User manual} opens the offline version of the App Manager user manual. It may also open the
online version if the corresponding feature split i.e.\ \texttt{feat\_docs} is not installed, or if an WebView is not
present in the system to load the manual.
%%!!>>

\subsubsection{1-Click Ops}\label{subsubsec:main:1-click-ops} %%##$1-click-ops-title>>
%%!!1-click-ops<<
\textbf{1-Click Ops} stands for the single-click operations. It opens the \hyperref[sec:1-click-ops-page]{corresponding
page} in a new activity.
%%!!>>

\subsubsection{App Usage} %%##$app-usage-title>>
%%!!app-usage<<
Application usage statistics, such as \textit{screen time}, \textit{data usage} (both mobile and
Wi-Fi), \textit{number of times an app was opened}, can be accessed by clicking on the \textbf{App
Usage} option in the menu. However, it requires the \textit{Usage Access} permission. This menu item
will not be listed if the usage access feature is disabled in \hyperref[subsubsec:enable/disable-features]{settings}.
%%!!>>

\subsubsection{Running Apps}\label{subsubsec:main:running-apps} %%##$running-apps-title>>
% TODO: Create a new page for the running apps
%%!!running-apps<<
This menu item opens a new page where a list of running applications or processes are displayed. It also displays the
current memory and cache (if available) usage. If root or ADB is not available to App Manager, it only displays itself
in the recent versions of Android. The running applications or processes can also be force-stopped or killed within the
resultant page. Logs for each process ID (PID) can also be viewed in the \hyperref[subsubsec:main:labs]{log viewer}.
In addition, it is also possible to carry out batch operations either by clicking on the icon or by long-clicking on an
item. Normal click on any items opens a dialog where a more detailed information is displayed.
%%!!>>

\subsubsection{Profiles} %%##$profiles-title>>
%%!!profiles<<
This menu item opens the \hyperref[sec:profiles-page]{profiles page}. Profiles are a way to configure regularly used
tasks. They can also be invoked via shortcuts.
%%!!>>

\subsubsection{APK Updater} %%##$apk-updater-title>>
%%!!apk-updater<<
If the app \href{https://github.com/rumboalla/apkupdater}{APK Updater} is installed in the system, it can be opened
directly via this menu item. The option remains hidden if the app is not present in the system.
%%!!>>

\subsubsection{Termux} %%##$termux-title>>
%%!!termux<<
If the app \href{https://github.com/termux/termux-app}{Termux} is installed in the system, the running session (or a
new session) can be opened directly via this menu item. The option remains hidden if the app is not present in the
system.
%%!!>>

\subsubsection{Debloater} %%##$debloater-title>>
%%!!debloater<<
This menu item opens the debloater page that lists all the bloatware available in the device and in
App Manager. It also suggests alternative applications based on the criteria set by the \href{https://github.com/MuntashirAkon/android-debloat-list}{Android Debloat List}
project.
%%!!>>

\subsubsection{Labs}\label{subsubsec:main:labs} %%##$labs-title>>
%%!!labs<<
This menu item opens the labs page that lists all the additional features. They include Log Viewer,
System Config, Terminal, File Manager (as Files), UI Tracker, Interceptor, and Code Editor pages.
%%!!>>

\subsubsection{Settings} %%##$settings-title>>
%%!!settings<<
This menu item opens the in-app \hyperref[sec:settings-page]{Settings page}.
%%!!>>
